package com.morontestandroid;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.ImageView;


public class MenyActivity extends Activity implements
		android.view.View.OnClickListener {
	/** Called when the activity is first created. */
	Button playGame;
	Button scores;
	Button about;
	Button exit;

Button lvl1;
Button lvl2;
Button lvl3;
Button lvl4;
Button lvl5;
Button lvl6;
Button lvl7;
Button lvl8;
Button lvl9;
Button lvl10;
Button CheckP;
ImageView birds;
AnimationDrawable AniBirds;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.meny_layout);
		playGame = (Button) findViewById(R.id.playGameId);
		scores = (Button) findViewById(R.id.scoresId);
		about = (Button) findViewById(R.id.aboutId);
		exit = (Button) findViewById(R.id.exitId);
		
		lvl1 = (Button) findViewById(R.id.lvl1);
		lvl2 = (Button) findViewById(R.id.lvl2);
		lvl3 = (Button) findViewById(R.id.lvl3);
		lvl4 = (Button) findViewById(R.id.lvl4);
		lvl5 = (Button) findViewById(R.id.lvl5);
		lvl6 = (Button) findViewById(R.id.lvl6);
		lvl7 = (Button) findViewById(R.id.lvl7);
		lvl8 = (Button) findViewById(R.id.lvl8);
		lvl9 = (Button) findViewById(R.id.lvl9);
		lvl10 = (Button) findViewById(R.id.lvl10);
		CheckP = (Button) findViewById(R.id.ChPoint);

        birds = (ImageView)findViewById(R.id.birds);
		
		playGame.setOnClickListener(this);
		scores.setOnClickListener(this);
		about.setOnClickListener(this);
		exit.setOnClickListener(this);
		
		lvl1.setOnClickListener(this);
		lvl2.setOnClickListener(this);
		lvl3.setOnClickListener(this);
		lvl4.setOnClickListener(this);
		lvl5.setOnClickListener(this);
		lvl6.setOnClickListener(this);
		lvl7.setOnClickListener(this);
		lvl8.setOnClickListener(this);
		lvl9.setOnClickListener(this);
		lvl10.setOnClickListener(this);
		CheckP.setOnClickListener(this);
		
        birds.setBackgroundResource(R.drawable.run_birds);
        AniBirds = (AnimationDrawable) birds.getBackground();
		
	}
		
		 
	 public void onWindowFocusChanged(boolean hasFocus) {

         super.onWindowFocusChanged(hasFocus);

       if(hasFocus) {
     	   startService(new Intent(this, MusicService.class)); 
     	   AniBirds.start();
       }  
 }
	

	@Override
	public void onClick(View view) {
		
		switch (view.getId()) {

		case R.id.playGameId:
			// implement playGame button.
			startActivity(new Intent(this, FirstLevel.class));
			break;
		case R.id.scoresId:
			// implement score button.
			startActivity(new Intent(this, ScoreActivity.class));
			break;

		case R.id.aboutId:
			startActivity(new Intent(this, AboutActivity.class));
			break;
		case R.id.exitId:
			// implement exit button
			break;
		case R.id.lvl1:
			startActivity(new Intent(this, FirstLevel.class));
			break;
		case R.id.lvl2:
			startActivity(new Intent(this, SecondLevel.class));
			break;
		case R.id.lvl3:
			startActivity(new Intent(this, ThirdLevel.class));
			break;
		case R.id.lvl4:
			startActivity(new Intent(this, FourthLevel.class));
			break;
		case R.id.lvl5:
			startActivity(new Intent(this, FifthLevel.class));
			break;
		case R.id.lvl6:
			startActivity(new Intent(this, SixthLevel.class));
			break;
		case R.id.lvl7:
			startActivity(new Intent(this, SeventhLevel.class));
			break;
		case R.id.lvl8:
			// implement exit button
			startActivity(new Intent(this, EighthLevel.class));
			break;
		case R.id.lvl9:
		            // new 
			break;
		case R.id.lvl10:
			startActivity(new Intent(this, TenthLevel.class));
			break;
		case R.id.ChPoint:
			startActivity(new Intent(this, CheckPoint.class));
			break;

		}

		// TODO Auto-generated method stub

	}





	private void setClickable(boolean b) {
		// TODO Auto-generated method stub
		
	}
}